import axios from "axios"
import NProgress from "nprogress"
const mockIns = axios.create({
  baseURL:"/mock",
  timeout:2000
})

mockIns.interceptors.request.use((config)=>{
  // 开启进度条
  NProgress.start()
  return config
})

mockIns.interceptors.response.use((res)=>{
  // 关闭进度条
  NProgress.done()
  return res.data
},(err)=>{
  NProgress.done()
  return Promise.reject(err)
})

export default mockIns